package com.yf.controller.api.im;

import com.yf.annotation.IgnoreAuth;
import com.yf.annotation.LoginUser;
import com.yf.entity.UserEntity;
import com.yf.response.R;
import com.yf.service.im.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * User: Administrator
 * Date: 2018-11-19
 * Time: 13:13
 * Description:
 */
@RequestMapping("/api/friend")
@RestController
public class ApiFriendController {

    @Autowired
    private FriendService friendService;


    /**
     * @Description: 查找好友
     * @author hyh
     * @Date 11:52 2018/9/10 0010
     * @Param  name 好友名称
     * @return
     */
    @GetMapping("/{name}/getFriend")
    public R getFriend(@LoginUser UserEntity userEntity,@PathVariable String name){
        return R.ok(friendService.findFriend(userEntity.getId(),name));
    }

    /**
     * @Description: 好友列表
     * @author hyh
     * @Date 11:52 2018/9/10 0010
     * @Param
     * @return
     */
    @GetMapping("/list")
    public R getFriendList(@LoginUser UserEntity userEntity){
        return R.ok(friendService.friendList(userEntity.getId()));
    }

}
